<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>列表</title>
    <link rel="stylesheet" href="../css/reset.css">
    <link rel="stylesheet" href="../css/Level0-classify-list.css">
</head>
<body>
<div id="title"></div>
<div id="content">
    <!--文字列表样式A-->
    <div id="textListStyleA" class="tab-content">
        <script type="text/html" id="textListStyleATemp">
            <ul class="simple-list">
                {{each}}
                <li class="list-item"
                    data-url="{{$imports.getListUrl($value)}}?id={{$value.id}}">
                    <div class="icon">
                        {{if $value.genre==3}}
                        <img src="../images/text-list/sp.png" alt="">
                        {{else}}
                        <img src="../images/text-list/wz.png" alt="">
                        {{/if}}
                    </div>
                    <h3 class="title marquee">{{$value.titleName}}</h3>
                    <span class="time">{{$value.createTime  |DateFormat 'yyyy-MM-dd'}}</span>
                </li>
                {{/each}}
            </ul>
        </script>
    </div>
    <!--文字列表样式B-->
    <div id="textListStyleB" class="tab-content">
        <script type="text/html" id="textListStyleBTemp">
            <ul class="simple-list">
                {{each}}
                <li class="list-item"
                    data-url="{{$imports.getListUrl($value.genre)}}?id={{$value.id}}">
                    <h3 class="title marquee">{{$value.titleName}}</h3>
                    <span class="time">{{$value.createTime  |DateFormat 'yyyy-MM-dd'}}</span>
                </li>
                {{/each}}
            </ul>
        </script>
    </div>
    <!--图片列表样式A-->
    <div id="imgListStyleA" class="tab-content">
    </div>
    <!--图片列表样式B-->
    <div id="imgListStyleB" class="tab-content card002">
        <script type="text/html" id="imgListStyleBTemp">
            {{each}}
            <div class="list-item" data-url="{{$imports.getListUrl($value.genre)}}?id={{$value.id}}">
                <div class="list-item-wrap">
                    <div class="thumb">
                        <img src="{{$value.pictures|getCover}}" alt="" onerror="this.src='../images/default.png'">
                    </div>
                    <div class="mask"></div>
                    <div class="title">{{$value.titleName}}</div>
                </div>
            </div>
            {{/each}}
        </script>
    </div>
    <!--视频列表样式A-->
    <div id="videoListStyleA" class="tab-content">
        <script type="text/html" id="videoListStyleATemp">
            {{each}}
            <div class="list-item" data-url="{{$imports.getListUrl($value)}}?id={{$value.id}}">
                <div class="list-item-wrap">
                    <div class="preview-img">
                        <img src="{{$imports.CONFIG.IMAGE_RESOURCES_ADDRESS+$value.pictures}}" alt=""
                             onerror="this.src='../images/default.png'">
                    </div>
                    <div class="play-btn">
                        <img src="../images/column-list/play.png" alt="">
                    </div>
                    <div class="title">
                        {{$value.titleName}}
                    </div>
                </div>
            </div>
            {{/each}}
        </script>
    </div>
    <!--视频列表样式B-->
    <div id="videoListStyleB" class="tab-content">
    </div>

</div>

<div id="page">
</div>

<script src="../js/S.js"></script>
<script src="../js/common.js"></script>
<script src="../js/tvProcess.js"></script>
<script src="../js/template-web.js"></script>
<script src="../js/list.js"></script>
<script src="../js/dialog.js"></script>
<script>
    keyopt.options.focusElm = 'listItem1';

    var uId = tools.getUrlParam('id') || '03280855138630000';
    var uMenuId = tools.getUrlParam('menuId') || '03271143006900001';
    var uTitle = tools.getUrlParam('title') || '群文动态';
    var sElemId = tools.getUrlParam('s_elemId') || 'textListStyleB';
    var sAction = tools.getUrlParam('s_action') ? tools.getUrlParam('s_action').split(',') : ['getDaYicultureContentList'];
    var titleMap = EXTEND.titleMap;
    for(var i=0;i<titleMap.length;i++){
        console.log(uTitle,titleMap[i].title,uTitle===titleMap[i].title);
        if(uTitle===titleMap[i].title){
            $('#title').html('<img src="../images/title/'+titleMap[i].pic+'" alt="">');
            break;
        }else {
            $('#title').html(uTitle);
        }
    }

    var page = tools.getSave('page') ? tools.getSave('page') - 1 : 0;


    var list = new List({
        action: sAction[0],
        tempId: sElemId + 'Temp',
        params: {
            menuId: uMenuId,
            pageIndex: page,
            pageSize: 6
        },
        callback: function (data) {
            if (keyopt.options.focusElm !== 'nextBtn' && keyopt.options.focusElm !== 'prevBtn')
                keyopt.moveToElm('listItem1');
            tools.recoveryFocus();
            list.setListOnSubmit(function (code, id) {
                tools.saveFocus({
                    page: list.def.currentPage,
                });
            });
            document.getElementById(list.def.tempId).parentNode.style.display = 'block';
        }
    });

    switch (sElemId) {
        case 'textListStyleA':
            list.setParams({pageSize: 8}).getData().addPageControl();
            break;
        case 'textListStyleB':
            list.setParams({pageSize: 8}).getData().addPageControl();
            break;
        case 'imgListStyleA':
            list.getData().addPageControl().addPositionControl(0, 0, 10, 10);
            break;
        case 'imgListStyleB':
            list.setColNum(3).getData().addPageControl().addPositionControl(248, 380, 10, 10);
            break;
        case 'videoListStyleA':
            list.setColNum(3).getData().addPageControl().addPositionControl(248, 380, 10, 10);
            break;
        case 'videoListStyleB':
            list.getData().addPageControl();
            break;
        default:
            break;
    }

</script>
</body>
</html>